package com.example.sale1.user;

import com.example.sale1.dto.UserQuery;
import com.example.sale1.mybatis.entity.User;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigInteger;
import java.util.List;

@Service
public class UserServiceImpl implements UserService{

    @Autowired
    UserDao userDao;

    @Override
    public int insertUser(User user) {
        return userDao.insertUser(user);
    }

    @Override
    public User selectUserById(BigInteger userId) {
        return userDao.selectUserById(userId);
    }

    @Override
    public User selectUserByUsername(String username) {
        return userDao.selectUserByUsername(username);
    }

    @Override
    public User selectUserByEmail(String email) {
        return userDao.selectUserByEmail(email);
    }

    @Override
    public List<User> selectUsers(User user) {
        return userDao.selectUsers(user);
    }

    @Override
    public PageInfo<User> selectUsersByPage(UserQuery query) {
        return userDao.selectUsersByPage(query);
    }

    @Override
    public int updateUser(User user) {
        return userDao.updateUser(user);
    }

    @Override
    public int deleteUserById(BigInteger userId) {
        return userDao.deleteUserById(userId);
    }


}
